package com.example.zhangxin.myhuatuob2b;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.Window;

import com.example.zhangxin.myhuatuob2b.activity.GuideActivity;
import com.example.zhangxin.myhuatuob2b.activity.MainFragmentManager;
import com.example.zhangxin.myhuatuob2b.utils.PreferenceUtils;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                SystemClock.sleep(2000);
                boolean is_frist = PreferenceUtils.getBoolean(MainActivity.this,"is_frist",true);
                if(is_frist){
                    Intent intent = new Intent(MainActivity.this,GuideActivity.class);
                    startActivity(intent);
                    PreferenceUtils.setBoolean(MainActivity.this,"is_frist",false);
                    MainActivity.this.finish();
                }else{
                    Intent intent = new Intent(MainActivity.this,MainFragmentManager.class);
                    startActivity(intent);
                    MainActivity.this.finish();
                }
            }
        },1000);
    }
}
